<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
</head>

<body>

  <script>
    function _flatten(arr) {
      // return arr.flat(Infinity)
      return arr.reduce((pre, cur) => {
        return pre.concat(Array.isArray(cur) ? _flatten(cur) : cur)
      }, [])
    }
  </script>
</body>

</html>